#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName :cp2_2.13.py
# @Time     :2023/7/10 18:33
# @Author   :Ash

if __name__ == "__main__":
    # 含有三个指向同一对象的引用的列表是毫无用处的
    weird_board = [['_'] * 3] * 3
    print(weird_board)
    weird_board[1][2] = 'O'
    print(weird_board)

    # 上面代码改写如下:
    row = ['_'] * 3
    board = []
    for i in range(3):
        board.append(row)
    print(board)
    board[2][0] = 'X'
    print(board)